# -*- coding: utf-8 -*-
import logging

logger = logging.getLogger("loggingtest")
hdr = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(name)s:%(levelname)s: %(message)s')
hdr.setFormatter(formatter)
logger.addHandler(hdr)

file_handler = logging.FileHandler("loggingtest.log")
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)

# logger.warning("测试logger")
# logging.warning("测试logging")

try:
    1/0
except Exception, e:
    # logger.error(e.message, e.args)
    logger.error(e.message)
